
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户列表</title>
    <link href="../static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="../static/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <style>
        td {
            text-align: center;
        }
    table{
        margin-top: 40px;
    }


    </style>
</head>
<body>
   <h6>用户列表</h6>
   <button class='btn btn-info' onclick="add()" style=position:absolute;right:1px;top:1px;z-index:988;">添加用户</button>
<table class="table table-hover table-bordered">
    <thead>
    <tr>
        <td>用户姓名</td>
        <td>真实姓名</td>
        <td>性别</td>
        <td>类型</td>
        <td colspan="3"> 操作</td>

    </tr>
    </thead>
    <c:forEach items="${sessionScope.p.list}" var="item">
        <tr>
            <td>${item.loginName}</td>
            <td>${item.userName}</td>
            <td>
                <c:if test="${item.sex eq '1'}" >男</c:if>
                <c:if test="${item.sex eq '0'}" >女</c:if>
            </td>

            <td>
                <c:if test="${item.type eq '1'}" >管理员</c:if>
                <c:if test="${item.type eq '0'}" >普通用户</c:if>
            </td>
            <td><a href="user?opr=getOne&id=${item.id}">修改</a></td>
             <td onclick="deleteUser(${item.id})"> <a href="#">删除</a></td>
        </tr>
    </c:forEach>
</table>
   <div class="text-center">
       <c:if test="${p.currentPage > 1}">
           <a href="user?opr=fenye&currentPage=1">首页</a>&nbsp;
           <a href="user?opr=fenye&currentPage=${p.currentPage-1}">上一页</a>&nbsp;&nbsp;
       </c:if>

       <c:if test="${p.currentPage <p.totalPage}">
           <a href="user?opr=fenye&currentPage=${p.currentPage+1}">下一页</a>&nbsp;&nbsp;
           <a href="user?opr=fenye&currentPage=${p.totalPage}">末页</a>
       </c:if>
   </div>
   <script src="../../static/js/jquery.min.js?v=2.1.4"></script>
   <script src="../../static/js/bootstrap.min.js?v=3.3.6"></script>
<script>

$(function () {


})
function deleteUser(id) {

    let falg=confirm("确定删除吗?");

    if(falg==true){
        location.href="user?opr=delteUser&id=";
    }else {
        alert("操作取消！！！")
    }
}
function add(){
    location.href="user?opr=getadd";
}
</script>
</body>
</html>
